﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace eGrocery.Web
{
    public class WebHelper
    {
        public static void RefreshAllControls(Control parent)
        {
            foreach (Control c in parent.Controls)
            {
                if (c is TextBox)
                {
                    var tb = c as TextBox;
                    if (tb != null)
                    {
                        tb.Text = String.Empty;
                    }
                }
                else if (c is DropDownList)
                {
                    var tb = c as DropDownList;
                    if (tb != null)
                    {
                        tb.SelectedIndex = 0;
                    }
                }

                RefreshAllControls(c);
            }

        }
    }
}